<?php


namespace App\Http\Controllers\Weapp;


use App\Http\Controllers\Controller;
use App\Model\User;
use App\Model\WeappToken;

class Base extends Controller
{

    /**
     * Create by Peter
     * 2019/12/10 11:34:31
     * Email:904801074@qq.com
     * @param $token
     * @return |null
     */
    function getUserInfo($token='')
    {


        if(func_num_args()==0) $token=request()->header('token');

        $data=WeappToken::with('user')->where('token',$token)->first();


        if(!$data) return null;

        return $data->user->toArray();

    }


}
